home *** CD-ROM | disk | FTP | other *** search
/ Directorty Opus 5 - Magellan 2 / Opus 5 - Magellan 2.iso / DOpus_SDK_5.5 / include / dopus / ipc.h < prev    next >
C/C++ Source or Header  |  1996-08-29  |  3KB  |  79 lines

  1. #ifndef _DOPUS_IPC
  2. #define _DOPUS_IPC
  3.  
  4. /*****************************************************************************
  5.  
  6.  Inter-process communication
  7.  
  8.  *****************************************************************************/
  9.  
  10. // IPC message
  11. typedef struct {
  12.     struct Message    msg;            // Exec message
  13.     ULONG        command;        // Message command
  14.     ULONG        flags;            // Message flags
  15.     APTR        data;            // Message data
  16.     APTR        data_free;        // Data to be FreeVec()ed automatically
  17.     struct _IPC    *sender;        // Sender IPC
  18. } IPCMessage;
  19.  
  20. #define REPLY_NO_PORT        (struct MsgPort *)-1    // Sync msg, no port supplied
  21. #define REPLY_NO_PORT_IPC    (struct MsgPort *)-2    // Sync msg from a non-IPC process
  22.  
  23. // IPC process
  24. typedef struct _IPC {
  25.     struct MinNode        node;
  26.     struct Process        *proc;        // Process pointer
  27.     IPCMessage        startup_msg;    // Startup message
  28.     struct MsgPort        *command_port;    // Port to send commands to
  29.     struct ListLock        *list;        // List we're a member of
  30.     APTR            userdata;
  31.     APTR            memory;        // Memory
  32.     struct MsgPort        *reply_port;    // Port for replies
  33.     ULONG            flags;        // Flags
  34. } IPCData;
  35.  
  36. #define IPCDATA(ipc)        ((APTR)ipc->userdata)
  37. #define SET_IPCDATA(ipc,data)    ipc->userdata=(APTR)data
  38.  
  39. // Used in the stack paramter for IPC_Launch
  40. #define IPCF_GETPATH        (1<<31)        // Want copy of path list
  41. #define IPCM_STACK(s)        (s&0xffffff)    // Mask out stack value
  42.  
  43. // Pre-defined commands
  44. enum {
  45.     IPC_COMMAND_BASE=0x8000000,
  46.     IPC_STARTUP,                // Startup command
  47.     IPC_ABORT,                // Abort!
  48.     IPC_QUIT,                // Quit process
  49.     IPC_ACTIVATE,                // Activate process
  50.     IPC_HELLO,                // Something saying hello
  51.     IPC_GOODBYE,                // Something saying goodbye
  52.     IPC_HIDE,                // Process, hide thyself
  53.     IPC_SHOW,                // Tell process to reveal itself
  54.     IPC_RESET,                // Process should reset
  55.     IPC_HELP,                // Help!
  56.     IPC_NEW,                // Create something new
  57.     IPC_GOT_GOODBYE,            // Got goodbye from something
  58.     IPC_IDENTIFY,                // Identify yourself
  59.     IPC_PRIORITY,                // Change your priority to this
  60.     IPC_REMOVE,                // Remove yourself
  61. };
  62.  
  63. // Pre-defined signals
  64. #define IPCSIG_HIDE        SIGBREAKF_CTRL_D
  65. #define IPCSIG_SHOW        SIGBREAKF_CTRL_E
  66. #define IPCSIG_QUIT        SIGBREAKF_CTRL_F
  67.  
  68.  
  69. ULONG IPC_Command(IPCData *,ULONG,ULONG,APTR,APTR,struct MsgPort *);
  70. IPCData *IPC_FindProc(struct ListLock *,char *,BOOL,ULONG);
  71. void IPC_Flush(IPCData *);
  72. void IPC_Free(IPCData *);
  73. long IPC_Launch(struct ListLock *,IPCData **,char *,ULONG,ULONG,ULONG,struct Library *);
  74. void IPC_ListCommand(struct ListLock *,ULONG,ULONG,ULONG,BOOL);
  75. IPCData *IPC_ProcStartup(ULONG *,ULONG (*__asm)(register __a0 IPCData *,register __a1 APTR));
  76. void IPC_Reply(IPCMessage *);
  77.  
  78. #endif
  79.